package com.lee.auth.security.authority;

import lombok.AllArgsConstructor;

/**
 * @author lee HN
 * @date 2021/8/3 17:18
 */
@AllArgsConstructor
public enum Authority {

    Root(1), Admin(2), Vip(10);

    public final int code;

    public static int obtainCode(String name) {
        Authority authority = null;
        try {
            authority = Authority.valueOf(name);
        } catch (IllegalArgumentException ignored) {}
        return authority == null ? 0 : authority.code;
    }
}
